Skip to content

Do not follow redirects when uploading#94

Merged
sigmavirus24 merged 1 commit intomasterfrom
bug/92
Apr 16, 2015
Merged

Do not follow redirects when uploading#94
sigmavirus24 merged 1 commit intomasterfrom
bug/92

Conversation

@sigmavirus24
Copy link
Copy Markdown
Member

PyPI will never redirect a user during an upload. If a redirect is
found, either the index URL is incorrect or there could be a malicious
redirect at play. requests has well defined behaviour around handling
POSTing data and what happens during a redirect. We shouldn't have to
think too hard about that and there's probably a problem the user needs
to handle if there is a redirect.

Requests added 'is_redirect()' to Response objects in 2.3.0. In order to
rely on that, we need to bump our minimum version.

Closes #92

@sigmavirus24
Copy link
Copy Markdown
Member Author

I think I'll also probably make this less of a pain so that users don't have to upgrade requests. I can probably make a helper function to do this for us.

Comment thread twine/commands/upload.py
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why check here if allow_redirects is already false?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I figured it out.

PyPI will never redirect a user during an upload. If a redirect is
found, either the index URL is incorrect or there could be a malicious
redirect at play. requests has well defined behaviour around handling
POSTing data and what happens during a redirect. We shouldn't have to
think too hard about that and there's probably a problem the user needs
to handle if there is a redirect.

Requests added 'is_redirect()' to Response objects in 2.3.0. In order to
rely on that, we need to bump our minimum version.

Closes #92
sigmavirus24 added a commit that referenced this pull request Apr 16, 2015
Do not follow redirects when uploading
@sigmavirus24 sigmavirus24 merged commit 37b1afa into master Apr 16, 2015
@sigmavirus24 sigmavirus24 deleted the bug/92 branch April 16, 2015 04:56
@sigmavirus24 sigmavirus24 modified the milestone: next Sep 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

twine should not fail silently

2 participants